<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>逾期罚息列表 管理</title>
    <style type="text/css">
    </style>
    <jsp:include page="../../import.jsp" flush="true"/>
</head>

<body class="iframeBody">
<div class="Wrapper">
    <div class="searchArea">
        <form id="searchBar">
            <div class="fieldset1 clearFix">
                <div class="fieldBox">
                    <div class="label">客户ID</div>
                    <div class="field">
                        <input name="cstId" id="cstId" type="text" validate="{number:true}" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">客户名称</div>
                    <div class="field">
                        <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">支付表ID</div>
                    <div class="field">
                        <input name="paySchId" id="paySchId" validate="{number:true}" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="fieldBox">
                    <div class="label">支付表号</div>
                    <div class="field">
                        <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="">
                    </div>
                </div>

                <div class="formBtns notRight">
                    <span id="searchBtn" class="sq-button sq-button-round">查询</span>
                    <span id="clearBtn" class="sq-button sq-button-round">清空</span>
                    <input id="resetBtn" type="reset" value="重置" class="l-button l-button-reset Hide"/>
                </div>
            </div>
        </form>
    </div>
    <div id="ligergrid1" class="sq-grid"></div>
</div>

<script type="text/javascript">
    var grid = null, form = null;
    $(function () {
        grid = $("#ligergrid1").ligerGrid({
            url: '<%=path%>/capital/capOverdueInfo/initList.do',
            method: 'get',
            columns: [
                {display: 'ID', name: 'id', minWidth: 100, align: 'left', enabledSort: false},
                {display: '客户ID', name: 'cstId', minWidth: 80, align: 'left', enabledSort: false},
                {display: '客户名称', name: 'cstNm', minWidth: 80, align: 'left', enabledSort: false},
                {display: '支付表ID', name: 'paySchId', width: 100, align: 'left', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '<a href="javascript:showPaySchDetail('+rowdata.paySchId+')"'+'class="link">'+rowdata.paySchId+'</a>';
                    }
                },
                {display: '支付表号', name: 'paySchNo', minWidth: 170, align: 'left', enabledSort: false},
                {display: '期次', name: 'payPd', minWidth: 60, align: 'center', enabledSort: false},
                {display: '逾期日期', name: 'overdueDate', width: 90, align: 'center', render: renderDate},
                {display: '逾期天数', name: 'overdueDay', minWidth: 80, align: 'center', enabledSort: false},
                {display: '罚息日期', name: 'createDate', width: 90, align: 'center', render: renderDate},
                {display: '逾期租金', name: 'overdueAmount', width: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.overdueAmount / 100);
                    }
                },
                {display: '罚息', name: 'penaltyAmount', width: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.penaltyAmount / 100);
                    }
                },
                {display: '已付罚息', name: 'payAmount', width: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.payAmount / 100);
                    }
                },
                {display: '减免罚息', name: 'reduAmount', width: 100, align: 'right', enabledSort: false,
                    render: function (rowdata, index, value) {
                        return '&yen;' + FormatMoney(rowdata.reduAmount / 100);
                    }
                },
                {display: '支付状态', name: 'overdueStatusCd', minWidth: 60, align: 'left', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if(value =="0"){
                            return "未支付";
                        }else if(value =="1"){
                            return "部分支付";
                        }else{
                            return "已支付";
                        }
                    }
                },
                {display: '数据状态', name: 'dataStatusCd', minWidth: 60, align: 'left', enabledSort: false,
                    render: function (rowdata, index, value) {
                        if(value =="0"){
                            return "最新";
                        }else{
                            return "过期";
                        }
                    }
                },
                {display: '累计期次', name: 'totalPayPd', minWidth: 80, align: 'center',},
            ],
            pageSize: 10,
            root: 'rows',
            record: 'total',
            hideLoadButton: true,
            width: '100%',
            height: '100%',
            heightDiff: -2,
            allowUnSelectRow: true,
            alternatingRow: false,
            delayLoad: true
        });
        grid.setHeight(100);

        form = $("#searchBar").ligerForm();
        $("#pageloading").hide();

        /* 查询 */
        $("#searchBtn").click(function (event) {
            form = liger.get("searchBar");
            var data = form.getData();
            var qt = "";
            for (name in data) {
                if(data[name]){
                   qt="ok";
                }
                grid.setParm(name, data[name]);
            }
            if(qt){
                grid.reload();
                qt = "";
            }else{
                $.ligerDialog.SQalert({content: "请输入查询条件", SQ_type: "warning"});
            }
        });

        /* 清空 */
        $("#clearBtn").click(function (event) {
            clearLigerForm("searchBar");
        });
        
    });

    //格式化时间
    function renderDate(rowdata, index, value) {
        var dateStr = "";
        if (null != value) {
            var date = new Date(value);
            dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
        }
        return dateStr;
    }

    //查看支付表明细
    function showPaySchDetail(paySchId){
        $.ajax({
            type: 'get',
            dataType: 'json',
            url: '<%=path%>/risk/ovdCollect/getPayInfo.do?paySchId='+paySchId,
            success: function (msg) {
                if (msg.success == 1) {
                    Add_navTab('tab_prj_quat_prps'+paySchId,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+msg.data.prjId+'&&id='+paySchId+'&&prjPrdDtlId='+msg.data.prjPrdDtlId+'&&prjPrdId='+msg.data.prjPrdId+'&&detailFlag=true');
                }
            }
        });
    }
</script>

</body>
</html>
